package start;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.core.Ordered;

class MyBeanPostProcessor implements BeanPostProcessor,Ordered {
    private int order=1;
    public MyBeanPostProcessor() {
        System.out.println("---------"+ this+"---------");
    }
    
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        Object result = bean;
        System.out.println(""+ this+":   "+"postProcessBeforeInitialization("+bean+","+beanName+")="+result);
        return result;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        Object result = bean;
        System.out.println(""+ this+":   "+"postProcessBeforeInitialization("+bean+","+beanName+")="+result);
        return result;
    }

    @Override
    public int getOrder() {
        System.out.println(""+ this+":   "+"getOrder()="+order);
        return order;
    }
}
